home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / ast_comp / flex-cpp.txt < prev    next >
Text File  |  1993-07-04  |  19KB  |  796 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.10 90/03/27 12:03:55 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. //CC #include <stdio.h>
  10. #include <iostream.h>
  11. extern istream * yyin;
  12. extern ostream * yyout;
  13.  
  14.  
  15. //CC #ifdef __cplusplus
  16. #include <stdlib.h>
  17. #include <osfcn.h>
  18.  
  19. /* use prototypes in function declarations */
  20. #define YY_USE_PROTOS
  21.  
  22. /* the "const" storage-class-modifier is valid */
  23. #define YY_USE_CONST
  24.  
  25. //CC #endif
  26.  
  27. //CC #ifdef __STDC__
  28. //CC #define YY_USE_PROTOS
  29. //CC #define YY_USE_CONST
  30. //CC #endif
  31.  
  32. //CC #ifdef __TURBOC__
  33. //CC #define YY_USE_CONST
  34. //CC #endif
  35.  
  36.  
  37. //CC #ifndef YY_USE_CONST
  38. //CC #define const
  39. //CC #endif
  40.  
  41. //CC #ifdef YY_USE_PROTOS
  42. //CC #define YY_PROTO(proto) proto
  43. //CC char *malloc( unsigned size );
  44. //CC int free( char * );
  45. //CC #else
  46. //CC #define YY_PROTO(proto) ()
  47. //CC /* there's no standard place to get these definitions */
  48. //CC char *malloc();
  49. //CC int free();
  50. //CC int read();
  51. //CC #endif
  52.  
  53. /* amount of stuff to slurp up with each read */
  54. #ifndef YY_READ_BUF_SIZE
  55. #define YY_READ_BUF_SIZE 8192
  56. #endif
  57.  
  58. /* returned upon end-of-file */
  59. #define YY_END_TOK 0
  60.  
  61. /* copy whatever the last rule matched to the standard output */
  62.  
  63. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  64. /* this used to be an fputs(), but since the string might contain NUL's,
  65.  * we now use fwrite()
  66.  */
  67. //CC #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  68. #define ECHO (yyout->write(yytext, yyleng))
  69.  
  70. /* report a fatal error */
  71. inline void YY_FATAL_ERROR(char * msg)
  72. {
  73.    cerr << msg << "\n";
  74.    exit(1);
  75. }
  76.  
  77. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  78.  * is returned in "result".
  79.  */
  80. //CC #define YY_INPUT(buf,result,max_size) \
  81. //CC    if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  82. //CC        YY_FATAL_ERROR( "read() in flex scanner failed" );
  83. #define YY_NULL 0
  84. inline void YY_INPUT(char * buf, int& result, int max_size)
  85. {
  86.    if( yyin->eof() || yyin->fail() ) {
  87.       result = YY_NULL;
  88.    }
  89.    else {
  90.       yyin->read(buf, max_size);
  91.       result = yyin->gcount();
  92.       if( yyin->bad() ) {
  93.      YY_FATAL_ERROR( "read() in flex scanner failed" );
  94.       }
  95.    }
  96. }
  97.  
  98. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  99.  * we don't want an extra ';' after the "return" because that will cause
  100.  * some compilers to complain about unreachable statements.
  101.  */
  102. #define yyterminate() return ( YY_NULL )
  103.  
  104. //CC /* report a fatal error */
  105. //CC #define YY_FATAL_ERROR(msg) \
  106. //CC     { \
  107. //CC     (void) fputs( msg, stderr ); \
  108. //CC     (void) putc( '\n', stderr ); \
  109. //CC     exit( 1 ); \
  110. //CC     }
  111.  
  112. /* default yywrap function - always treat EOF as an EOF */
  113. #define yywrap() 1
  114.  
  115. /* enter a start condition.  This macro really ought to take a parameter,
  116.  * but we do it the disgusting crufty way forced on us by the ()-less
  117.  * definition of BEGIN
  118.  */
  119. #define BEGIN yy_start = 1 + 2 *
  120.  
  121. /* action number for EOF rule of a given start state */
  122. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  123.  
  124. /* special action meaning "start processing a new file" */
  125. #define YY_NEW_FILE { \
  126.     yy_init_buffer( yy_current_buffer, yyin ); \
  127.         yy_load_buffer_state(); \
  128.     }
  129.  
  130. /* default declaration of generated scanner - a define so the user can
  131.  * easily add parameters
  132.  */
  133. //CC #define YY_DECL int yylex YY_PROTO(( void ))
  134. #define YY_DECL int yylex ( void )
  135.  
  136. /* code executed at the end of each rule */
  137. #define YY_BREAK break;
  138.  
  139. #define YY_END_OF_BUFFER_CHAR 0
  140.  
  141. #ifndef YY_BUF_SIZE
  142. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  143. #endif
  144.  
  145. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  146.  
  147. %% section 1 definitions go here
  148.  
  149. /* done after the current pattern has been matched and before the
  150.  * corresponding action - sets up yytext
  151.  */
  152. #define YY_DO_BEFORE_ACTION \
  153.     yytext = yy_bp; \
  154. %% code to fiddle yytext and yyleng for yymore() goes here
  155.     yy_hold_char = *yy_cp; \
  156.     *yy_cp = '\0'; \
  157.     yy_c_buf_p = yy_cp;
  158.  
  159. #define EOB_ACT_CONTINUE_SCAN 0
  160. #define EOB_ACT_END_OF_FILE 1
  161. #define EOB_ACT_LAST_MATCH 2
  162.  
  163. /* return all but the first 'n' matched characters back to the input stream */
  164. #define yyless(n) \
  165.     { \
  166.     /* undo effects of setting up yytext */ \
  167.     *yy_cp = yy_hold_char; \
  168.     yy_c_buf_p = yy_cp = yy_bp + n; \
  169.     YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  170.     }
  171.  
  172. #define unput(c) yyunput( c, yytext )
  173.  
  174.  
  175. struct yy_buffer_state
  176.     {
  177.     istream * yy_input_file;
  178.  
  179.     YY_CHAR *yy_ch_buf;        /* input buffer */
  180.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  181.  
  182.     /* size of input buffer in bytes, not including room for EOB characters*/
  183.     int yy_buf_size;
  184.  
  185.     /* number of characters read into yy_ch_buf, not including EOB characters */
  186.     int yy_n_chars;
  187.  
  188.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  189. #define EOF_NOT_SEEN 0
  190.     /* "pending" happens when the EOF has been seen but there's still
  191.      * some text process
  192.      */
  193. #define EOF_PENDING 1
  194. #define EOF_DONE 2
  195.     };
  196.  
  197. static YY_BUFFER_STATE yy_current_buffer;
  198.  
  199. /* we provide macros for accessing buffer states in case in the
  200.  * future we want to put the buffer states in a more general
  201.  * "scanner state"
  202.  */
  203. #define YY_CURRENT_BUFFER yy_current_buffer
  204.  
  205.  
  206. /* yy_hold_char holds the character lost when yytext is formed */
  207. static YY_CHAR yy_hold_char;
  208.  
  209. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  210.  
  211.  
  212.  
  213. #ifndef YY_USER_ACTION
  214. #define YY_USER_ACTION
  215. #endif
  216.  
  217. extern YY_CHAR *yytext;
  218. extern int yyleng;
  219. extern istream * yyin;
  220. extern ostream * yyout;
  221.  
  222. YY_CHAR *yytext;
  223. int yyleng;
  224.  
  225. istream * yyin = 0;
  226. ostream * yyout =  0;
  227.  
  228. %% data tables for the DFA go here
  229.  
  230. /* these variables are all declared out here so that section 3 code can
  231.  * manipulate them
  232.  */
  233. /* points to current character in buffer */
  234. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  235. static int yy_init = 1;        /* whether we need to initialize */
  236. static int yy_start = 0;    /* start state number */
  237.  
  238. //CC static yy_state_type yy_last_accepting_state;
  239. //CC static YY_CHAR *yy_last_accepting_cpos;
  240.  
  241. static yy_state_type yy_get_previous_state ( void );
  242. static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
  243. static int yy_get_next_buffer ( void );
  244. static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
  245. void yyrestart ( istream * input_file );
  246. void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
  247. void yy_load_buffer_state ( void );
  248. YY_BUFFER_STATE yy_create_buffer ( istream * file, int size );
  249. void yy_delete_buffer ( YY_BUFFER_STATE b );
  250. void yy_init_buffer ( YY_BUFFER_STATE b, istream * file );
  251.  
  252. #ifdef __cplusplus
  253. static int yyinput ( void );
  254. #else
  255. static int input ( void );
  256. #endif
  257.  
  258. YY_DECL
  259.     {
  260.     register yy_state_type yy_current_state;
  261.     register YY_CHAR *yy_cp, *yy_bp;
  262.     register int yy_act;
  263.  
  264. %% user's declarations go here
  265.  
  266.     if ( yy_init )
  267.     {
  268.     if ( ! yy_start )
  269.         yy_start = 1;    /* first start state */
  270.  
  271.     if ( ! yyin )
  272.         yyin = &cin;
  273.  
  274.     if ( ! yyout )
  275.         yyout = &cout;
  276.  
  277.     if ( yy_current_buffer )
  278.         yy_init_buffer( yy_current_buffer, yyin );
  279.     else
  280.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  281.  
  282.     yy_load_buffer_state();
  283.  
  284.     yy_init = 0;
  285.     }
  286.  
  287.     while ( 1 )        /* loops until end-of-file is reached */
  288.     {
  289. %% yymore()-related code goes here
  290.     yy_cp = yy_c_buf_p;
  291.  
  292.     /* support of yytext */
  293.     *yy_cp = yy_hold_char;
  294.  
  295.     /* yy_bp points to the position in yy_ch_buf of the start of the
  296.      * current run.
  297.      */
  298.     yy_bp = yy_cp;
  299.  
  300. %% code to set up and find next match goes here
  301.  
  302. yy_find_action:
  303. %% code to find the action number goes here
  304.  
  305.     YY_DO_BEFORE_ACTION;
  306.     YY_USER_ACTION;
  307.  
  308. do_action:    /* this label is used only to access EOF actions */
  309.  
  310. %% debug code goes here
  311.  
  312.     switch ( yy_act )
  313.         {
  314. %% actions go here
  315.  
  316.         case YY_END_OF_BUFFER:
  317.         {
  318.         /* amount of text matched not including the EOB char */
  319.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  320.  
  321.         /* undo the effects of YY_DO_BEFORE_ACTION */
  322.         *yy_cp = yy_hold_char;
  323.  
  324.         /* note that here we test for yy_c_buf_p "<=" to the position
  325.          * of the first EOB in the buffer, since yy_c_buf_p will
  326.          * already have been incremented past the NUL character
  327.          * (since all states make transitions on EOB to the end-
  328.          * of-buffer state).  Contrast this with the test in yyinput().
  329.          */
  330.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  331.             /* this was really a NUL */
  332.             {
  333.             yy_state_type yy_next_state;
  334.  
  335.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  336.  
  337.             yy_current_state = yy_get_previous_state();
  338.  
  339.             /* okay, we're now positioned to make the
  340.              * NUL transition.  We couldn't have
  341.              * yy_get_previous_state() go ahead and do it
  342.              * for us because it doesn't know how to deal
  343.              * with the possibility of jamming (and we
  344.              * don't want to build jamming into it because
  345.              * then it will run more slowly)
  346.              */
  347.  
  348.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  349.  
  350.             yy_bp = yytext + YY_MORE_ADJ;
  351.  
  352.             if ( yy_next_state )
  353.             {
  354.             /* consume the NUL */
  355.             yy_cp = ++yy_c_buf_p;
  356.             yy_current_state = yy_next_state;
  357.             goto yy_match;
  358.             }
  359.  
  360.             else
  361.             {
  362. %% code to do backtracking for compressed tables and set up yy_cp goes here
  363.             goto yy_find_action;
  364.             }
  365.             }
  366.  
  367.         else switch ( yy_get_next_buffer() )
  368.             {
  369.             case EOB_ACT_END_OF_FILE:
  370.             {
  371.             if ( yywrap() )
  372.                 {
  373.                 /* note: because we've taken care in
  374.                  * yy_get_next_buffer() to have set up yytext,
  375.                  * we can now set up yy_c_buf_p so that if some
  376.                  * total hoser (like flex itself) wants
  377.                  * to call the scanner after we return the
  378.                  * YY_NULL, it'll still work - another YY_NULL
  379.                  * will get returned.
  380.                  */
  381.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  382.  
  383.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  384.                 goto do_action;
  385.                 }
  386.  
  387.             else
  388.                 YY_NEW_FILE;
  389.             }
  390.             break;
  391.  
  392.             case EOB_ACT_CONTINUE_SCAN:
  393.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  394.  
  395.             yy_current_state = yy_get_previous_state();
  396.  
  397.             yy_cp = yy_c_buf_p;
  398.             yy_bp = yytext + YY_MORE_ADJ;
  399.             goto yy_match;
  400.  
  401.             case EOB_ACT_LAST_MATCH:
  402.             yy_c_buf_p =
  403.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  404.  
  405.             yy_current_state = yy_get_previous_state();
  406.  
  407.             yy_cp = yy_c_buf_p;
  408.             yy_bp = yytext + YY_MORE_ADJ;
  409.             goto yy_find_action;
  410.             }
  411.         break;
  412.         }
  413.  
  414.         default:
  415. #ifdef FLEX_DEBUG
  416.         printf( "action # %d\n", yy_act );
  417. #endif
  418.         YY_FATAL_ERROR(
  419.             "fatal flex scanner internal error--no action found" );
  420.         }
  421.     }
  422.     }
  423.  
  424.  
  425. /* yy_get_next_buffer - try to read in a new buffer
  426.  *
  427.  * synopsis
  428.  *     int yy_get_next_buffer();
  429.  *
  430.  * returns a code representing an action
  431.  *     EOB_ACT_LAST_MATCH -
  432.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  433.  *     EOB_ACT_END_OF_FILE - end of file
  434.  */
  435.  
  436. static int yy_get_next_buffer()
  437.  
  438.     {
  439.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  440.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  441.     register int number_to_move, i;
  442.     int ret_val;
  443.  
  444.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  445.     YY_FATAL_ERROR(
  446.         "fatal flex scanner internal error--end of buffer missed" );
  447.  
  448.     /* try to read more data */
  449.  
  450.     /* first move last chars to start of buffer */
  451.     number_to_move = yy_c_buf_p - yytext;
  452.  
  453.     for ( i = 0; i < number_to_move; ++i )
  454.     *(dest++) = *(source++);
  455.  
  456.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  457.     /* don't do the read, it's not guaranteed to return an EOF,
  458.      * just force an EOF
  459.      */
  460.     yy_n_chars = 0;
  461.  
  462.     else
  463.     {
  464.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  465.  
  466.     if ( num_to_read > YY_READ_BUF_SIZE )
  467.         num_to_read = YY_READ_BUF_SIZE;
  468.  
  469.     else if ( num_to_read <= 0 )
  470.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  471.  
  472.     /* read in more data */
  473.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  474.           yy_n_chars, num_to_read );
  475.     }
  476.  
  477.     if ( yy_n_chars == 0 )
  478.     {
  479.     if ( number_to_move == 1 )
  480.         {
  481.         ret_val = EOB_ACT_END_OF_FILE;
  482.         yy_current_buffer->yy_eof_status = EOF_DONE;
  483.         }
  484.  
  485.     else
  486.         {
  487.         ret_val = EOB_ACT_LAST_MATCH;
  488.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  489.         }
  490.     }
  491.  
  492.     else
  493.     ret_val = EOB_ACT_CONTINUE_SCAN;
  494.  
  495.     yy_n_chars += number_to_move;
  496.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  497.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  498.  
  499.     /* yytext begins at the second character in yy_ch_buf; the first
  500.      * character is the one which preceded it before reading in the latest
  501.      * buffer; it needs to be kept around in case it's a newline, so
  502.      * yy_get_previous_state() will have with '^' rules active
  503.      */
  504.  
  505.     yytext = &yy_current_buffer->yy_ch_buf[1];
  506.  
  507.     return ( ret_val );
  508.     }
  509.  
  510.  
  511. /* yy_get_previous_state - get the state just before the EOB char was reached
  512.  *
  513.  * synopsis
  514.  *     yy_state_type yy_get_previous_state();
  515.  */
  516.  
  517. static yy_state_type yy_get_previous_state()
  518.  
  519.     {
  520.     register yy_state_type yy_current_state;
  521.     register YY_CHAR *yy_cp;
  522.  
  523. %% code to get the start state into yy_current_state goes here
  524.  
  525.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  526.     {
  527. %% code to find the next state goes here
  528.     }
  529.  
  530.     return ( yy_current_state );
  531.     }
  532.  
  533.  
  534. /* yy_try_NUL_trans - try to make a transition on the NUL character
  535.  *
  536.  * synopsis
  537.  *     next_state = yy_try_NUL_trans( current_state );
  538.  */
  539.  
  540. //CC #ifdef YY_USE_PROTOS
  541. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  542. //CC #else
  543. //CC static yy_state_type yy_try_NUL_trans( yy_current_state )
  544. //CC register yy_state_type yy_current_state;
  545. //CC #endif
  546.  
  547.     {
  548.     register int yy_is_jam;
  549. %% code to find the next state, and perhaps do backtracking, goes here
  550.  
  551.     return ( yy_is_jam ? 0 : yy_current_state );
  552.     }
  553.  
  554.  
  555. //CC #ifdef YY_USE_PROTOS
  556. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  557. //CC #else
  558. //CC static void yyunput( c, yy_bp )
  559. //CC YY_CHAR c;
  560. //CC register YY_CHAR *yy_bp;
  561. //CC #endif
  562.  
  563.     {
  564.     register YY_CHAR *yy_cp = yy_c_buf_p;
  565.  
  566.     /* undo effects of setting up yytext */
  567.     *yy_cp = yy_hold_char;
  568.  
  569.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  570.     { /* need to shift things up to make room */
  571.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  572.     register YY_CHAR *dest =
  573.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  574.     register YY_CHAR *source =
  575.         &yy_current_buffer->yy_ch_buf[number_to_move];
  576.  
  577.     while ( source > yy_current_buffer->yy_ch_buf )
  578.         *--dest = *--source;
  579.  
  580.     yy_cp += dest - source;
  581.     yy_bp += dest - source;
  582.     yy_n_chars = yy_current_buffer->yy_buf_size;
  583.  
  584.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  585.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  586.     }
  587.  
  588.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  589.     yy_cp[-2] = '\n';
  590.  
  591.     *--yy_cp = c;
  592.  
  593.     /* note: the formal parameter *must* be called "yy_bp" for this
  594.      *       macro to now work correctly
  595.      */
  596.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  597.     }
  598.  
  599.  
  600. #ifdef __cplusplus
  601. static int yyinput()
  602. #else
  603. static int input()
  604. #endif
  605.  
  606.     {
  607.     int c;
  608.     YY_CHAR *yy_cp = yy_c_buf_p;
  609.  
  610.     *yy_cp = yy_hold_char;
  611.  
  612.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  613.     {
  614.     /* yy_c_buf_p now points to the character we want to return.
  615.      * If this occurs *before* the EOB characters, then it's a
  616.      * valid NUL; if not, then we've hit the end of the buffer.
  617.      */
  618.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  619.         /* this was really a NUL */
  620.         *yy_c_buf_p = '\0';
  621.  
  622.     else
  623.         { /* need more input */
  624.         yytext = yy_c_buf_p;
  625.         ++yy_c_buf_p;
  626.  
  627.         switch ( yy_get_next_buffer() )
  628.         {
  629.         case EOB_ACT_END_OF_FILE:
  630.             {
  631.             if ( yywrap() )
  632.             {
  633.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  634.             return ( EOF );
  635.             }
  636.  
  637.             YY_NEW_FILE;
  638.  
  639. #ifdef __cplusplus
  640.             return ( yyinput() );
  641. #else
  642.             return ( input() );
  643. #endif
  644.             }
  645.             break;
  646.  
  647.         case EOB_ACT_CONTINUE_SCAN:
  648.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  649.             break;
  650.  
  651.         case EOB_ACT_LAST_MATCH:
  652. #ifdef __cplusplus
  653.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  654. #else
  655.             YY_FATAL_ERROR( "unexpected last match in input()" );
  656. #endif
  657.         }
  658.         }
  659.     }
  660.  
  661.     c = *yy_c_buf_p;
  662.     yy_hold_char = *++yy_c_buf_p;
  663.  
  664.     return ( c );
  665.     }
  666.  
  667.  
  668. //CC #ifdef YY_USE_PROTOS
  669. void yyrestart( istream * input_file )
  670. //CC #else
  671. //CC void yyrestart( input_file )
  672. //CC FILE * input_file;
  673. //CC #endif
  674.  
  675.     {
  676.     yy_init_buffer( yy_current_buffer, input_file );
  677.     yy_load_buffer_state();
  678.     }
  679.  
  680.  
  681. //CC #ifdef YY_USE_PROTOS
  682. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  683. //CC #else
  684. //CC void yy_switch_to_buffer( new_buffer )
  685. //CC YY_BUFFER_STATE new_buffer;
  686. //CC #endif
  687.  
  688.     {
  689.     if ( yy_current_buffer == new_buffer )
  690.     return;
  691.  
  692.     if ( yy_current_buffer )
  693.     {
  694.     /* flush out information for old buffer */
  695.     *yy_c_buf_p = yy_hold_char;
  696.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  697.     yy_current_buffer->yy_n_chars = yy_n_chars;
  698.     }
  699.  
  700.     yy_current_buffer = new_buffer;
  701.     yy_load_buffer_state();
  702.     }
  703.  
  704.  
  705. //CC #ifdef YY_USE_PROTOS
  706. void yy_load_buffer_state( void )
  707. //CC #else
  708. //CC void yy_load_buffer_state()
  709. //CC #endif
  710.  
  711.     {
  712.     yy_n_chars = yy_current_buffer->yy_n_chars;
  713.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  714.     yyin = yy_current_buffer->yy_input_file;
  715.     yy_hold_char = *yy_c_buf_p;
  716.     }
  717.  
  718.  
  719. //CC #ifdef YY_USE_PROTOS
  720. YY_BUFFER_STATE yy_create_buffer( istream * file, int size )
  721. //CC #else
  722. //CC YY_BUFFER_STATE yy_create_buffer( file, size )
  723. //CC FILE *file;
  724. //CC int size;
  725. //CC #endif
  726.  
  727.     {
  728.     YY_BUFFER_STATE b;
  729.  
  730.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  731.  
  732.     if ( ! b )
  733.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  734.  
  735.     b->yy_buf_size = size;
  736.  
  737.     /* yy_ch_buf has to be 2 characters longer than the size given because
  738.      * we need to put in 2 end-of-buffer characters.
  739.      */
  740.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  741.  
  742.     if ( ! b->yy_ch_buf )
  743.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  744.  
  745.     yy_init_buffer( b, file );
  746.  
  747.     return ( b );
  748.     }
  749.  
  750.  
  751. //CC #ifdef YY_USE_PROTOS
  752. void yy_delete_buffer( YY_BUFFER_STATE b )
  753. //CC #else
  754. //CC void yy_delete_buffer( b )
  755. //CC YY_BUFFER_STATE b;
  756. //CC #endif
  757.  
  758.     {
  759.     if ( b == yy_current_buffer )
  760.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  761.  
  762.     free( (char *) b->yy_ch_buf );
  763.     free( (char *) b );
  764.     }
  765.  
  766.  
  767. //CC #ifdef YY_USE_PROTOS
  768. void yy_init_buffer( YY_BUFFER_STATE b, istream *file )
  769. //CC #else
  770. //CC void yy_init_buffer( b, file )
  771. //CC YY_BUFFER_STATE b;
  772. //CC FILE *file;
  773. //CC #endif
  774.  
  775.     {
  776.     b->yy_input_file = file;
  777.  
  778.     /* we put in the '\n' and start reading from [1] so that an
  779.      * initial match-at-newline will be true.
  780.      */
  781.  
  782.     b->yy_ch_buf[0] = '\n';
  783.     b->yy_n_chars = 1;
  784.  
  785.     /* we always need two end-of-buffer characters.  The first causes
  786.      * a transition to the end-of-buffer state.  The second causes
  787.      * a jam in that state.
  788.      */
  789.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  790.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  791.  
  792.     b->yy_buf_pos = &b->yy_ch_buf[1];
  793.  
  794.     b->yy_eof_status = EOF_NOT_SEEN;
  795.     }
  796.